Repository navigation
Fix dashboard scrollbar freezing when documents arrive during a drag - #621
Open
MeshanKhosla wants to merge 1 commit into
Open
MeshanKhosla wants to merge 1 commit into
MeshanKhosla wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the dashboard's Data page, the scrollbar can stop responding while you're dragging it if a new document arrives. This requires users to release the mouse and grab the scrollbar again to keep scrolling.
This happens because when the row count changes, the scrollbar cancels its pending animation frame but doesn't clear the stored frame ID in
rafIdRef. So when the mouse moves again, it thinks there's already a frame scheduled and doesn't start a new one.This change:
nullconsistently for no pending frame, as MDN recommends, since a valid frame ID can be0.Testing
Tested this with production builds of the self-hosted dashboard and a local Convex backend:
Videos are below.
Before the fix, the table stopped scrolling after the document arrived. After the fix, it kept scrolling without needing to release the mouse.
Also tested row-count and viewport changes during a drag, repeated updates, release and restart, mouseleave, unmounting, replacing the list, and a valid frame ID of zero. All passed with the fix.
dashboard-commonlint, build, and typechecking passed, along with the dprint check for the changed file.I haven't included automated tests since this component and the adjacent files don't have tests in the public checkout. Happy to add tests if you'd prefer.
Videos
Before:
convex-scroll-before-github.mp4
After:
convex-scroll-after-github.mp4
Note: I also noticed that, when the scrollbar handle uses its minimum size, it stays at the top until its calculated position exceeds 64px. This comes from subtracting
MIN_SCROLLBAR_SIZEfrom its position. This is existing behavior and changing that is out of scope of this PR.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.